# Contributor: Jakub Jirutka <jakub@jirutka.cz>
# Maintainer: Jakub Jirutka <jakub@jirutka.cz>
pkgname=ttfautohint
pkgver=1.8.4
pkgrel=0
pkgdesc="Automated hinting utility for TrueType fonts"
url="https://freetype.org/ttfautohint/"
arch="all"
license="FTL OR GPL-2.0-only"
makedepends="
	autoconf
	automake
	freetype-dev
	harfbuzz-dev
	libtool
	qt5-qtbase-dev
	"
subpackages="
	$pkgname-dev
	$pkgname-gui
	$pkgname-libs
	$pkgname-doc
	"
source="https://download.savannah.gnu.org/releases/freetype/ttfautohint-$pkgver.tar.gz
	musl-compat.patch
	"
options="!check"  # no tests provided

prepare() {
	default_prepare

	echo "$pkgver" > VERSION
	sed -i \
		-e '/dist_man_MANS/d' \
		-e 's/manpages/dist_man_MANS/' \
		frontend/local.mk

	autoreconf -fiv
}

build() {
	./configure \
		--build=$CBUILD \
		--host=$CHOST \
		--prefix=/usr \
		--sysconfdir=/etc \
		--mandir=/usr/share/man \
		--localstatedir=/var \
		--without-doc \
		--disable-silent-rules
	make
}

package() {
	make DESTDIR="$pkgdir" install
}

gui() {
	pkgdesc="$pkgdesc (Qt GUI)"

	amove usr/bin/ttfautohintGUI
}

sha512sums="
983517c360f8e65ccbf17f28f045f1c0a45078707f2e30f465a7b6df4014f0ec212780ea2703bc16be1a3c6ede70f71ea3051c067fbfd06eff40ae3b20840eec  ttfautohint-1.8.4.tar.gz
6d6443f45130681a1cfe506ddf78a050de5d787c91fff8830bea41c20037d23c51839b73b39fb3209a11852aad595937ea7783b95cca7e18829b15f89da2f460  musl-compat.patch
"
